def file = new File('sample.md')

file.withReader { Reader reader ->
	def firstLine = reader.readLine()
	println firstLine
}

// file -> stream 
// closure 接收的参数是 java.io.BufferedInputStream
file.withInputStream { inputStream ->
	def firstByte = inputStream.read()
	println firstByte
}

def lines = file.readLines()

println lines.dump()
println lines.inspect()
println lines

println '-' * 32

file.eachLine {
	println it
}
